package cn.fastoo.alipay;

import java.io.FileWriter;
import java.io.IOException;


/* *
 *类名：AlipayConfig
 *功能：基础配置类
 *详细：设置帐户有关信息及返回路径
 *修改日期：2017-04-05
 *说明：
 *以下代码只是为了方便商户测试而提供的样例代码，商户可以根据自己网站的需要，按照技术文档编写,并非一定要使用该代码。
 *该代码仅供学习和研究支付宝接口使用，只是提供一个参考。
 */

public class AlipayConfig {

//↓↓↓↓↓↓↓↓↓↓请在这里配置您的基本信息↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓

    // 应用ID,您的APPID，收款账号既是您的APPID对应支付宝账号
    public static String app_id = "2017080508048394";

    // 商户私钥，您的PKCS8格式RSA2私钥
    public static String merchant_private_key = "MIIEvQIBADANBgkqhkiG9w0BAQEFAASCBKcwggSjAgEAAoIBAQDK+EY4c6TA+Vg9PqilTrcE3wrSgh+AKFOGhH27aac8Ibdl4iLkmLluadWZMO4cNaj1F4AVJvkCkdkufv9smcyzpddZ63r+7lWm0Nu0vCJ7ASLFWz0sK+pRXo1nukBUA9DF1+J9YKsGQp4YeJPJPYX92wzhxvQNv9EwEBZ6QHAT1nKpvdycOJfUQXz/JZ4t8OuzJnMlxYBhTJJc58oTJQuVMhmUqopqWNacPWtXc7cBj77LKUD+qExTHPkn/4V3rwYcaGSnVzbX4hH5JU9njJbqkfnRsQbV+a9QkmRzB+ng3GEGIpxNscQZBe/qJhQFt7ZwEBhYugK1B6rZR84mP9h5AgMBAAECggEAMeCrGOpKPWXI6lwAg4cBcMAC39I8PXkrdW4Pm8ON5jf+4pmcq4JgZyK468lbajFBkOEyh4ApRxliPovU5vIwnKEPd7hnZEhbYgAHTbXB32pbChauxLESBubuZuQdNMgvQL8ZmGft/z7VrPvMjXKB/+0ZkE4c4VgW5vG9JFO7dxQW05o5D5bDOpuYT8BZlN8fBwnrUDl7eZ472S4wGMm9tB1B9xS93mCGmO+OFG0gNbj3O1qYhgacIMXW7JVfJ1eIN1saDTvlJ2jbRqMY+zhT0WqKJkaERT9eAUBUYd+AQ61WwlO4NljEweWCvnCqYyv4RZKHJvSpQ2B5/McAJV8bAQKBgQDnbfR8UeX5vN4bih+nvUO/lO2TPWx/kRmPDwRIMiJKKM5q9O9p2l/QkyCAGnUBnoUceSsHVNb2Orye7zkO29ybLdPNaeLUaTDLjBZaoCuyfNveDgzqCE29xqNydm84nXm+dOdnfJIoT92jxgS2XhRTvGYYknA6i/EcBOME4C9RIQKBgQDghM+EaIb/KREnUjODr4hgHDxt/zFpa9KZIWFVSrxMTmkmI2I5MuWx4GLDqIanewZ8a34TgPrGHzZIB8exA5P8icflREJCXa8WJJmWp8nyPvjsx46EepMkaTsLMayLQPm3cZNKqBCyXOtf/uFXPE4M64pjETUhQVVK2w3ereQkWQKBgEXCrD7JRSR5nQ36Hb6nW4OlddO7YTg22dh4s1a73gAyur4c5QoobFdn8hULZJe/W+qQT7sfBMkmPXM/Mxjah24zazPxJhHXP4Er0hUxUNq1rmUKITRumliJRv2a273aIjeZ76MPNtN1956FcygxxbjUAoaHpdLQGjbS9kei+EBhAoGAWY4ALEN5XXvnALU0IRm6HwQEQqfg8Lj2Zug+p8PIufMo0/KXMlOP9VSYcIzfMRzMaIKD5omy/aXjg/W+fGf99mSK3HNOrqQpu35b2RESZ1Mg/WlX+pXd7U8gIwXsWhtPwBFIfCXviwWvSTokbiR6yYKGT5/EfoBN4i7gKGtaLfkCgYEAgyD7jV0JqlIyQxGueGapeZFiOGOC956oRbpBtv4L+H+usppoMOrWYmIv+PdKgj8qMG70WhnT0XAimUxidvecXS53vpjgwp7+VrqjXQAASJ0slkt3L+EWldWi5ydv6UT9dZ0FLJ/EmYRqLfPnJxcnfZz/Tq+VW/eCo2Jel0mJ7aU=";

    // 支付宝公钥,查看地址：https://openhome.alipay.com/platform/keyManage.htm 对应APPID下的支付宝公钥。
    public static String alipay_public_key = "MIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEAjpEvc+kfnxS5bqRVIcTBDjsrc2rKl2/A3rdjfhOdXTAzVKu1X5FRjCpUMz+buEm8aRhJUik+31JYeax8mxxllvaFIsR/HtetRqF64xB29k4Mxg0QkBo4LtPDh2c0YTgU+FUfbwF7i7lq1XZmKDbmAiYIjbtALx2KJxMZUU+dWtCxdrMqolT3IGczrbsbObFbmFEQWgbGP+wZLYit+LqApU/9RNqcZ4YVGABeWuzXKudt7UG98VX2zgwZ9Ahy1SDhqU9MSPnmSHfsAyotiDGFEoORK+ZJjEuye1dzwtPc6MAERHMCL469vj+EMy8S8ePfMelBcE4Hel5c6dLpp00rrQIDAQAB";

    // 服务器异步通知页面路径  需http://格式的完整路径，不能加?id=123这类自定义参数，必须外网可以正常访问
    public static String notify_url = "http://120.26.10.238:12020/v1/sys/updateStatus";

    // 页面跳转同步通知页面路径 需http://格式的完整路径，不能加?id=123这类自定义参数，必须外网可以正常访问
    public static String return_url = "http://120.26.10.238:12020/v1/sys/updateStatus";

    // 签名方式
    public static String sign_type = "RSA2";

    // 字符编码格式
    public static String charset = "utf-8";

    // 支付宝网关
    public static String gatewayUrl = "https://openapi.alipay.com/gateway.do";

    // 支付宝网关
    public static String log_path = "";


//↑↑↑↑↑↑↑↑↑↑请在这里配置您的基本信息↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑

    /**
     * 写日志，方便测试（看网站需求，也可以改成把记录存入数据库）
     * @param sWord 要写入日志里的文本内容
     */
    public static void logResult(String sWord) {
        FileWriter writer = null;
        try {
            writer = new FileWriter(log_path + "alipay_log_" + System.currentTimeMillis()+".txt");
            writer.write(sWord);
        } catch (Exception e) {
            e.printStackTrace();
        } finally {
            if (writer != null) {
                try {
                    writer.close();
                } catch (IOException e) {
                    e.printStackTrace();
                }
            }
        }
    }
}

